export const getLocal = (name: string) => {
  return localStorage.getItem(name);
};

export const setLocal = (name: string, value) => {
  localStorage.setItem(name, value);
};

export const getToken = () => {
  return getLocal("suss-app-token");
};

export const setToken = (value: string) => {
  setLocal("suss-app-token", value);
};

export const getUserData = () => {
  const userData = getLocal("suss-app-user-data");
  if (userData !== null) {
    return JSON.parse(userData);
  }
  return {};
};

export const setUserData = (value) => {
  setLocal("suss-app-user-data", JSON.stringify(value));
};
